package com.zhang.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhang.mapper.IManMapper;
import com.zhang.pojo.ManBean;
import com.zhang.service.IManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ManServiceImpl implements IManService {
    @Autowired
    private IManMapper manMapper;

    @Override
    public void add(ManBean manBean) {
        manMapper.add(manBean);
    }

    @Override
    public PageInfo<ManBean> findAll(int pageNo) {
        PageHelper.startPage(pageNo,10);
        PageInfo<ManBean> man = PageInfo.of(manMapper.findAll());
        System.out.println(man);
        return man;
    }

    @Override
    public void del(int id) {
        manMapper.del(id);
    }

    @Override
    public ManBean findById(int id) {
        return manMapper.findById(id);
    }

    @Override
    public void update(int id, String birthday) {
        manMapper.update(id, birthday);
    }
}
